<script setup>

import { ref } from 'vue';

const sendMessage = ref('')

</script>

<template>
    <main>
        <el-row style="width: 100%;" justify="center">
            <el-col :span="5">
                <div class="left">
                    <div class="statusBar" style="border-bottom-color:#fff; color:#fff;">
                        <div class="title">消息列表</div>
                    </div>
                    <div class="userList">
                        <div class="userItem" v-for="item in 10" :key="item">
                            <el-avatar style="background-color: #fff;" shape="square" :size="30" src="https://www.devcat.cn/res/img/avatar.png"></el-avatar>
                            <div class="userDescribe">Huhailong{{ item }}</div>
                        </div>
                    </div>
                </div>
            </el-col>
            <el-col :span="12">
                <div class="right">
                    <div class="statusBar">
                        <div class="currentChatUsername">正在与 <span style="font-weight:bold;">Huhailong</span> 对话</div>
                    </div>
                    <div class="messageBox">
                        <div class="msgList">
                            <div class="reciveer">
                                <el-avatar style="margin-right:5px; background-color: #fff;" shape="square" src="https://www.devcat.cn/res/img/avatar.png"></el-avatar>
                                <el-card>
                                    Hello World!<br/>Huhailong
                                </el-card>
                            </div>
                            <div class="sender">
                                <el-card>Hello World!</el-card>
                                <el-avatar style="margin-left:5px; background-color: #fff;" shape="square" src="https://www.devcat.cn/res/img/avatar.png"></el-avatar>
                            </div>
                        </div>
                    </div>
                    <div class="chatBox">
                        <el-input v-model="sendMessage" type="textarea" class="inputArea" resize="none"></el-input>
                        <el-button type="primary" class="sendBtn">发送</el-button>
                    </div>
                </div>
            </el-col>
        </el-row>
    </main>
</template>

<style scoped>
main{
    height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    background-color: #eee;
}
.left, .right{
    height: 80vh;
}
.left{
    background-color: #272B4E;
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
}
.right{
    background-color: #fff;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
}
.userList{
    padding: 10px;
}
.userItem{
    display: flex;
    align-items: center;
    background-color: #fff;
    margin: 15px 0;
    padding: 5px;
    border-radius: 5px;
    cursor: pointer;
}
.userItem:hover{
    opacity: 0.8;
}
.userDescribe{
    font-size: 14px;
}
.statusBar{
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #aaa;
}
.messageBox{
    height: calc(100% - 343px);
}
.chatBox{
    border-top: 1px solid #aaa;
    height: 300px;
    position: relative;
    font-size: 14px;
}
.sendBtn{
    position: absolute;
    bottom: 0;
    right: 0;
    margin: 10px;
    width: 100px;
}
.inputArea{
    height: 300px;
}
.chatBox>>>.el-textarea__inner{
    height: 300px;
}
.reciveer{
    display: flex;
    align-items: center;
    padding: 5px;
}
.sender{
    display: flex;
    align-items: center;
    justify-content: end;
    padding: 5px;
}
</style>